use std::result;
use thiserror::Error;

#[derive(Error, Debug,PartialEq)]
pub enum Errors {
    #[error("faild to read data from file")]
    FailedToReadDataFileError,

    #[error("faild to write data from file")]
    FailedToWriteDataFileError,

    #[error("faild to sync data from file")]
    FailedToSyncDataFileError,

    #[error("faild to open data from file")]
    FailedToOpenDataFileError,

    #[error("key is empty")]
    KeyIsEmptyError,

    #[error("index update failed")]
    IndexUpdateError,

    #[error("key is not found")]
    KeyIsNotFound,

    #[error("data file not found")]
    DataFileNotFound,

    #[error("database dir path is empty")]
    DirPathIsEmpty,

    #[error("database data file size is too small")]
    DataFileSizeTooSmall,

    #[error("failed create data dir")]
    FailedCreateDataDirError,

    #[error("failed read data dir")]
    FailedReadDataDirError,

    #[error("data dir maybe corrupte")]
    DataDirCorrupted,

    #[error("read data EOF")]
    ReadDataEOFError,

    #[error("invalid log record crc")]
    InvalidLogRecordCrc,
}

pub type Result<T> = result::Result<T, Errors>;
